package com.quanyan.ic.vendingMachine.protocol.server.session;

import io.netty.channel.Channel;

import java.io.Serializable;

/**
 * Created by zhuo.shi on 2017/7/31.
 */
public class Session implements Serializable {

    private String id;
    private Channel channel;
    private long lastCommunicateTimeStamp;

    public static Session build(String id, Channel channel) {
        Session session = new Session();
        session.setId(id);
        session.setChannel(channel);
        session.setLastCommunicateTimeStamp(System.currentTimeMillis());
        return session;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Channel getChannel() {
        return channel;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public long getLastCommunicateTimeStamp() {
        return lastCommunicateTimeStamp;
    }

    public void setLastCommunicateTimeStamp(long lastCommunicateTimeStamp) {
        this.lastCommunicateTimeStamp = lastCommunicateTimeStamp;
    }
}
